package com.cloud.multiClientSocket;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class MyUdpServer {
    public static void main(String[] args) throws IOException {
        //udp使用5555端口
        DatagramSocket ds = new DatagramSocket(5555);
        byte[] buf = new byte[1024];
        DatagramPacket dp_receive = new DatagramPacket(buf, 1024);

        ds.receive(dp_receive);
        System.out.println("收到udp消息");
        System.out.println("客户端发送udp端口为" + dp_receive.getPort());
    }

}
